﻿using Microsoft.Phone.Controls;
using System.Windows.Controls;

namespace Caltrain
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void ListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            ListBox listbox = (ListBox)sender;
            listbox.SelectedIndex = listbox.Items.IndexOf(listbox.SelectedItem);
            listbox.UpdateLayout();
            listbox.ScrollIntoView(listbox.SelectedItem);
        }

        private void about_Click(object sender, System.EventArgs e)
        {
            NavigationService.Navigate(new System.Uri("/About.xaml", System.UriKind.Relative));
        }

        private void systemMap_Click(object sender, System.EventArgs e)
        {
            NavigationService.Navigate(new System.Uri("/SystemMap.xaml", System.UriKind.Relative));
        }
    }
}
